#!/bin/bash
# 更新软件源
sudo apt-get update
echo -e "y" | sudo apt-get upgrade

# 安装一些常用软件
echo -e "y" | sudo apt-get install zsh git vim samba samba-common openssh-server

mkdir ~/env && cd ~/env

git clone https://gitee.com/ChenBlue/ohmyzsh.git

git clone https://gitee.com/ChenBlue/PowerVim.git

git clone https://gitee.com/ChenBlue/shell.git

# samba
sudo mkdir -p /home/$LOGNAME/wk

sudo chmod 777 /home/$LOGNAME/wk

sudo smbpasswd -a $LOGNAME

cp /etc/samba/smb.conf .

echo "[$(hostname)]" >> smb.conf
echo "comment = share folder">> smb.conf
echo "browseable = yes" >> smb.conf
echo "path = /home/$LOGNAME/wk" >> smb.conf
echo "create mask = 0700" >> smb.conf
echo "directory mask = 0700" >> smb.conf
echo "valid users = $LOGNAME" >> smb.conf
echo "force user = $LOGNAME" >> smb.conf
echo "force group = $LOGNAME" >> smb.conf
echo "public = yes" >> smb.conf
echo "available = yes" >> smb.conf
echo "writable = yes" >> smb.conf

sudo mv smb.conf /etc/samba/smb.conf

sudo service smbd restart

# 配置
/home/$LOGNAME/env/PowerVim/install.sh

/home/$LOGNAME/env/shell/git.sh

echo -e "y" | /home/$LOGNAME/env/ohmyzsh/tools/install.sh

/home/$LOGNAME/env/shell/alias.sh
